#include "Point.h"
using namespace std;

int Point::n_Point = 0;

Point::Point(int x, int y) {
    //cout <<"    ctor "<< endl;
    absis = x;
    ordinat = y;
    n_Point++;
}

Point::Point(const Point& orig) {
    //cout <<"    copy "<< endl;
    absis = orig.absis;
    ordinat = orig.ordinat;
    n_Point++;
}

Point::~Point() {
    //cout <<"    dtor "<< endl;
    absis = 0;
    ordinat = 0;
    n_Point--;
}

Point& Point::operator=(const Point& orig) {
    // cout <<"    assignment "<< endl;
    absis = orig.absis;
    ordinat = orig.ordinat;
    return *this;
}

void Point::setPoint (int x, int y){
    absis = x;
    ordinat = y;	
}

int Point::getAbsis() const{
    return absis;
}


int Point::getOrdinat() const{
    return ordinat;
}



ostream& operator<< (ostream& stream, const Point& P){
	stream << '(' << P.absis << ',' << P.ordinat << ')';
}


Point operator+ (const Point& p1, const Point& p2){
    Point temp;
    temp.absis = p1.absis + p2.absis;
    temp.ordinat = p1.ordinat + p2.ordinat;
    return temp;
}
   
Point operator- (const Point& p1, const Point& p2){
    Point temp;
    temp.absis = p1.absis - p2.absis;
    temp.ordinat = p1.ordinat - p2.ordinat;
    return temp;
}

Point operator* (const Point& P, int X){
    Point temp;
    temp.absis = P.absis*X;
    temp.ordinat = P.ordinat*X;
    return temp;
}

Point operator* (int X, const Point& P){
	return P*X;
}

Point operator/ (const Point& P, int X){
    Point temp;
    temp.absis = P.absis/X;
    temp.ordinat = P.ordinat/X;
    return temp;
}

Point operator/ (int X, const Point& P){
	return P/X;
}

int Point::dot(const Point& P) const{
    return absis*P.absis+ordinat*P.ordinat;
}

/*Point& Point::Mirror(const Point& p1,const Point&p2) const{
	Point temp;
	temp=2*(p2-p1)*(p2-p1).dot(*this-p1)/(p2-p1).dot(p2-p1)-*this;
	return *temp);
}*/
